// pages/loop/loop.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    loop: ["https://exam.obs.cn-south-1.myhwclouds.com/e31a7206-fd24-4fe3-8a0e-fe1ea01ff9f3.mp4","https://v21.obs.cn-south-1.myhwclouds.com/32593df3-4b2c-4490-921e-d5aa6f616fd7.mp4"],
    showMask: true,
    animationData: {},
    showNext: false,
    animation: "",
    windowHeight: 0
  },
  bindchange(e){
    console.log(e)
  },
  bindanimationfinish(e){
    console.log(1,e)
  },
  play(){
    console.log(1)
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let _this = this
    wx.getSystemInfo({
      success: function(data){
        console.log(data)
        _this.setData({
          windowHeight: data.windowHeight
        })
      }
    })
  },
  next(){
    var that = this;
    var animation = wx.createAnimation({
      duration: 300,
      timingFunction: 'linear',
      delay: 0
    })
    that.setData({
      showNext: true
    })
    this.animation = animation
    animation.translateY(-1 * this.data.windowHeight).step()
    that.setData({
      animationData: animation.export(),
    })
  },
  pre(){
    var that = this;
    var animation = wx.createAnimation({
      duration: 300,
      timingFunction: 'linear',
      delay: 0
    })
    this.animation = animation
    animation.translateY(0).step()
    setTimeout(function(){
      that.setData({
        showNext: false
      })   
    },300)
    that.setData({
      animationData: animation.export(),
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    // this.videoContext1 = wx.createVideoContext('myVideo1')
    // this.videoContext2 = wx.createVideoContext('myVideo2')
    // this.videoContext3 = wx.createVideoContext('myVideo3')
  },
  bindPlay: function () {
    this.videoContext1.play()
    this.setData({
      showMask:false
    })
    this.videoContext1.requestFullScreen()
  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})